﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Domain.MainModule.Entities;
using Infraestructure.Data.MainModule.UnitOfWork;
using Infraestructure.CrossCutting.Logging;
using Domain.MainModule.RateParamTypes;
using Infraestructure.Data.MainModule.Repositories;

namespace Infraestructure.Data.MainModule.Tests.RepositoriesTests
{
    /// <summary>
    ///This is a test class for RateParamTypeRepositoryTest and is intended
    ///to contain all RateParamTypeRepositoryTest Unit Tests
    ///</summary>
    [TestClass()]
    public class RateParamTypeRepositoryTest : RepositoryTestsBase<RateParamType>
    {
       
       public override System.Linq.Expressions.Expression<Func<RateParamType, bool>> FilterExpression
        {
            get { return a => a.TypeId == TestConstants.Instance.RATE_PARAM_TYPE_ID; }
        }

        public override System.Linq.Expressions.Expression<Func<RateParamType, Guid>> OrderByExpression
        {
            get { return a => a.TypeId; }
        }

        /// <summary>
        ///A test for FindRateParamType
        ///</summary>
        [TestMethod()]
        public void FindRateParamTypeById_Invoke_Test()
        {
            //Arrange 
            IMainModuleUnitOfWork context = GetUnitOfWork();
            ITraceManager traceManager = this.GetTraceManager();
            IRateParamTypeRepository repository = new RateParamTypeRepository(context, traceManager);

            RateParamTypeIdSpecification spec = new RateParamTypeIdSpecification(TestConstants.Instance.RATE_PARAM_TYPE_ID);

            //Act
            RateParamType rateParamType = repository.FindRateParamType(spec);

            //Assert
            Assert.IsNotNull(rateParamType);
        }

        /// <summary>
        ///A test for FindRateParamType
        ///</summary>
        [TestMethod()]
        public void FindRateParamTypeByName_Invoke_Test()
        {
            //Arrange 
            IMainModuleUnitOfWork context = GetUnitOfWork();
            ITraceManager traceManager = this.GetTraceManager();
            IRateParamTypeRepository repository = new RateParamTypeRepository(context, traceManager);

            RateParamTypeNameSpecification spec = new RateParamTypeNameSpecification("name");

            //Act
            IEnumerable<RateParamType> rateParamType = repository.FindRateParamTypes(spec);

            //Assert
            Assert.IsNotNull(rateParamType);
        }	
    }
}
